const Sequelize = require('sequelize');
module.exports = function(sequelize, DataTypes) {
  return sequelize.define('sp_role', {
    role_id: {
      autoIncrement: true,
      type: DataTypes.SMALLINT.UNSIGNED,
      allowNull: false,
      primaryKey: true
    },
    role_name: {
      type: DataTypes.STRING(20),
      allowNull: false,
      comment: "角色名称"
    },
    ps_ids: {
      type: DataTypes.STRING(512),
      allowNull: false,
      defaultValue: "",
      comment: "权限ids,1,2,5"
    },
    ps_ca: {
      type: DataTypes.TEXT,
      allowNull: true,
      comment: "控制器-操作,控制器-操作,控制器-操作"
    },
    role_desc: {
      type: DataTypes.TEXT,
      allowNull: true
    }
  }, {
    sequelize,
    tableName: 'sp_role',
    timestamps: false,
    indexes: [
      {
        name: "PRIMARY",
        unique: true,
        using: "BTREE",
        fields: [
          { name: "role_id" },
        ]
      },
    ]
  });
};
